<?php
	// for now, just placeholder
	$hashing_value = "visitor"."buttoncolor";
	$hashed = md5($hashing_value);
	$substring = substr($hashed, 0, 7);
	$hashed_as_dec = hexdec($substring);
	$max_value = hexdec("FFFFFFF");
	$probability = $hashed_as_dec / $max_value;
	
	if ($probability < 0.33) {
		$buttoncolor = "#5c77af";
		$condition = "blue";
	} else if ($probability < 0.66) {
		$buttoncolor = "#af423c";
		$condition = "red";
	} else {
		$buttoncolor = "#32af43";
		$condition = "green";		
	}
?>

<script src="../jquery.js" type="text/javascript" charset="utf-8"></script>
<script>
	$(document).ready(function(){
		$("#mybutton").click(function(){
			$.get('logger.php', {
				'event':'buttonclick',
				'category':'ui-logs',
				'condition': '<?php echo $condition ?>',
				'extra': ""
			}, function(){
				console.log("logged!");
			})
		})
	})

</script>
<body>
	<a href="#" id="mybutton" style="background-color:<?php echo $buttoncolor ?>; padding: 10px; color:white">Click me please!</a>
</body>